package org.itboys.product.service;

import org.itboys.mongodb.core.MongoDataSource;
import org.itboys.mongodb.service.BaseService;
import org.itboys.product.constant.ProductConstant;
import org.itboys.product.entity.Product;
import org.itboys.product.entity.ProductCount;
import org.itboys.product.entity.ProductText;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by ZHL on 2016/1/14.
 */
@Service
public class ProductTextService extends BaseService<ProductText, Long> {
    @Resource(name = "productDS")
    private MongoDataSource ds;
    @Override
    protected MongoDataSource getMongoDataSource() {
        return ds;
    }

    @Override
    protected Class<ProductText> getEntityClass() {
        // TODO Auto-generated method stub
        return ProductText.class;
    }
    public boolean insert(ProductText productText){
        try{
            if(productText.getId() != 0){
                update(productText);
            }else{
                save(productText);
            }

//			String tags[]=tagList.split(",");
            //标签的实体类 具体怎么保存 等这周和陈老师讨论下
            return true;
        }catch(Exception e){
            e.printStackTrace();
            logger.error("ProductTextService.save error", e);
        }
        return false;
    }
}
